/**
 * 
 */
package com.feonix.common.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;

import com.feonix.common.BaseInfo;

/**
 * @CopyRight (c)1993-2017
 * @Project m-complat-common
 * @Comments 系统注册过滤器
 * @NameSpace com.feonix.common.interceptor
 * @Author Feonixzw
 * @CreateDate 2017年11月21日
 */
public class SystemRegInterceptor extends BaseInterceptor {

	@Override
	public boolean before(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,
			Object object) {
		if (BaseInfo.isPrepared())
			return true;
		try {
			httpServletResponse.sendRedirect(BaseInfo.getContextPath() + "/error/unregistered");
		} catch (Exception exception) {
			this.logger.error("sendRedirect error:", exception);
		}
		return false;
	}

	@Override
	public void after(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object object,
			ModelAndView modelAndView) {

	}

	@Override
	public void complete(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object object,
			Exception exception) {

	}

}
